﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace NGinnBPM.Lib.Interfaces
{
    /// <summary>
    /// Task instance status
    /// </summary>
    public enum TaskStatus
    {
        Enabling = 0,
        Enabled = 1,
        Selected = 2,
        Completed = 3,
        Cancelled = 4,
        Failed = 5,
        Cancelling = 6 ///do we need that?
    }

    [DataContract]
    public class TaskInstanceInfo
    {
        /// <summary>
        /// task instance ID
        /// </summary>
        [DataMember]
        public string InstanceId { get; set; }
        [DataMember]
        public string TaskId { get; set; }
        [DataMember]
        public string ParentTaskInstanceId { get; set; }
        [DataMember]
        public string ProcessInstanceId { get; set; }
        [DataMember]
        public string ProcessDefinitionId { get; set; }
        [DataMember]
        public Dictionary<string, object> TaskData { get; set; }
        [DataMember]
        public TaskStatus Status { get; set; }
        /// <summary>
        /// Task start date
        /// </summary>
        [DataMember]
        public DateTime EnabledDate { get; set; }
        /// <summary>
        /// Task finish date
        /// </summary>
        [DataMember]
        public DateTime? FinishedDate { get; set; }
        /// <summary>
        /// Current marking of a composite task/process instance
        /// </summary>
        [DataMember]
        public Dictionary<string, int> Marking { get; set; }
        /// <summary>
        /// Map instance ID->task ID 
        /// for all active child tasks of a composite task
        /// </summary>
        [DataMember]
        public Dictionary<string, string> ActiveChildTasks { get; set; }
    }
}
